﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO;
using VAdvantage.Utility;

namespace VAdvantage.Framework
{
    public partial class TenantInfo : ChildWindow
    {
        public TenantInfo()
        {
            InitializeComponent();
        }
        public void SetData(string data)
        {
            txtData.Text=data;
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.DefaultExt = "Text (*.txt)|*.txt";
            saveFileDialog.Filter = "Text (*.txt)|*.txt";
            bool? ret = saveFileDialog.ShowDialog();
            if (ret.HasValue && (bool)ret)
            {
                using (StreamWriter sw = new StreamWriter(saveFileDialog.OpenFile()))
                {

                    sw.Write(txtData.Text);
                    sw.Write(Envs.NL);           

                }
            }
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

